package mylab.exception;

import mylab.String.StringUtils;

public class Exception {
	
	public static void main(String args[]) {
		
		int d, a; 
		
		try { // monitor a block of code. 
			
				d = 0; 
				a = 42 / d; 
				System.out.println("This will not be printed."); 
			
			} catch (ArithmeticException e) 
			{ // catch divide-by-zero error
				//System.out.println(e);
				//System.out.println(e.getMessage());
				//e.printStackTrace();
				//System.out.println(e.getCause());
				System.out.println(StringUtils.getLinesOfStackTrace(e, 5));
				//System.out.println("Division by zero."); 
			} 
		//System.out.println("After catch statement."); 
	} 
}
